﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 提示面板
/// </summary>
public class TipPanel : BasePanelUI
{
    public Text tipText;
    private string tipStr;
    public Button adsButton;
    public Button skipButton;
    public Button okButton;
    public bool isGetTip;
    public GameObject lockObj;
    public override void Init()
    {
        base.Init();

    }

    public override void BtnEvent()
    {
        base.BtnEvent();


        adsButton.onClick.AddListener(() =>
        {
            SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
            adsButton.gameObject.SetActive(false);
            skipButton.gameObject.SetActive(true);
            okButton.gameObject.SetActive(true);
            tipText.text = tipStr;
           
        });
        skipButton.onClick.AddListener(() =>
        {

            SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
            GameCtrl.Instance.playPanel.SkipLevel();
            Hide();


        });

        okButton.onClick.AddListener(() =>
        {
            SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
            Hide();
        });
    }

    public void Show(string tip)
    {
        tipStr = tip;
        adsButton.gameObject.SetActive(true);

        skipButton.gameObject.SetActive(false);
        okButton.gameObject.SetActive(false);

        tipText.text = "确定要看提示吗？";

        base.Show(() =>
        {
            SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
        });
    }
}
